#include "bsp_seg_595.h" 
#include "systick.h"
#include "stm32f10x.h"


uint8_t SEG_Code[]=
{
   0x00,
   0x00,
   0x05,//1
   0x76,//2
   0x6f,//0
   0x76,//2
   0x57,//3
   0x6f,//0
   0x07,//7
   0x05,//1
   0x6f,//0
   0x76,//2
   0x6f //0
};

void SEG_595_GPIO_Config(void)
{
    GPIO_InitTypeDef GPIO_InitStructure;
	  RCC_APB2PeriphClockCmd( DS_595_GPIO_CLK | STCP_595_GPIO_CLK | SHCP_595_GPIO_CLK , ENABLE);
	  GPIO_InitStructure.GPIO_Pin = DS_595_GPIO_PIN | STCP_595_GPIO_PIN | SHCP_595_GPIO_PIN ;
	  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
	  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	  GPIO_Init(DS_595_GPIO_PORT, &GPIO_InitStructure);
 
     
}

void SendOneChar_595(uint8_t nchar)
{
	uint8_t i=0,mask=0x80;
	
	for(i=0;i<8;i++)
	{
	if((nchar&mask)==0)DS_595_L();
	else DS_595_H();
	
	SHCP_595_L();
	SHCP_595_H();
	mask=(mask>>1);
	}
	STCP_595_L();
	STCP_595_H();
}
